
import 'package:flutter/material.dart';
import 'package:flutterdemo01/demo3/pages/FirstNewsListPage.dart';

Map<String, WidgetBuilder> routes={

  '/mm':(context,{arguments})=> FirstNewsListPage(msg: arguments,),

};



// // 如果你要把路由抽离出去，必须写下面这一堆的代码，不用理解什么意思
var onGenerateRoute = (RouteSettings settings) {
  // 统一处理

  final String? name = settings.name;
  final Function? pageContentBuilder = routes[name];
  if (pageContentBuilder != null) {
    if (settings.arguments != null) {
      final Route route = MaterialPageRoute(
          builder: (context) =>
              pageContentBuilder(context, arguments: settings.arguments));
      return route;
    } else {
      final Route route =
      MaterialPageRoute(builder: (context) => pageContentBuilder(context));
      return route;
    }
  }
};
